package com.googlecode.i78ba.login;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface UserMapper {
	@Insert({ "insert into user (name,password,email,register_time) ",
		" values (#{name},#{password},#{email},#{register_time})" })
	public void insert(User user);

	@Select({ "select * from user where name = #{name}" })
	public User findByName(String name);

	@Select({ "select * from user where id = #{id}" })
	public User findById(int id);

	@Select({ "select * from user where register_time is not null ",
		" order by register_time desc limit 1" })
	public User findNewest();

	@Select({ "select count(*) from user" })
	public int findCount();
}
